<?php
	if(isset($_GET['PHPSESSID'])) {
		session_id($_GET['PHPSESSID']);
	}
	
	session_start();
	
	// files need this defined token so they can't be open by outside people.
	define('YMT', true);
	define('YOMM_PATH', 'Yomm/');
	
	require_once('site_config.php');
	
	if(SiteConfig::Debugger === true) {
		ini_set('display_errors', 1); error_reporting(E_ALL);
	} else {
		error_reporting(0);
	}
	
	require_once(YOMM_PATH . 'Loader.class.php');
	
	$yomm_loader = new Yomm_Loader();
	$yomm_loader->addPrefixFilter('Devmod');
	$yomm_loader->addPrefixFilter('Smarty');
	$yomm_loader->start();
	
	// set the url boot controller param: example.com?controller=TO_LOAD_CONTROLLER
	Yomm_Registry::set("boot_controller_param", "controller");
	
	// set the method of the controller which should be booted: example.com?controller=TO_LOAD_CONTROLLER&method=TO_LOAD_METHOD
	Yomm_Registry::set("boot_controller_method_param", "method");
	
	// set the default controller if nothing is given from get:
	Yomm_Registry::set("boot_controller_default", "index");
	
	// set the default method of the controller if nothing is given from get:
	Yomm_Registry::set("boot_controller_method_default", "index");
	
	try {
		$yomm_boot = new Yomm_Boot();
		$yomm_boot_return = $yomm_boot->doReturn();
		echo $yomm_boot_return;
	} catch (Exception $error) {
		print_r($error);
		exit;
	}